package com.richman.ps38;



public class LoginThread extends Thread {

	
	PS38Selenium ps38selenium = null;
	
	public void setPS38Selenium(PS38Selenium p) {
		ps38selenium = p;
	}
	
	@Override
    public void run() {
		
		try{
			
			ps38selenium.updateStatusCode(0);
			
			 int failedTimes = 2;
			
			

		        while(true) {
		            if(ps38selenium.Login() == 1) {
		            	break;
		            }else {
		            	 Thread.sleep(failedTimes*10*1000);
		            	 failedTimes = failedTimes*failedTimes;
		            }
		            
		        }
				
			

		}catch(Exception e){
			e.printStackTrace();
			
			ps38selenium.updateStatusCode(-1);
			
		}	
		
		System.out.println("exit");
	}

}

